<?php
include $_SERVER['DOCUMENT_ROOT'].'/fr/include/init.php';
include $_SERVER['DOCUMENT_ROOT'].'/fr/include/require_login.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/meta.php'; ?>
	<meta name="description" content="Herbes de Chine : Facture" />
	<meta name="keywords" content="Herbes de chine,facture,compte,suivi,mon compte,profil,historique,historique des commandes,commandes en cours" />
	<title>Facture</title>
	<link href="/fr/css/common.css" rel="stylesheet" type="text/css" />
	<link href="/fr/css/inside.css" rel="stylesheet" type="text/css" />
	<link href="print.css" rel="stylesheet" type="text/css" media="print" />
	<script language="javascript" type="text/javascript" src="/fr/js/static.js"></script>
</head>
<body>
	<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/header.php'; ?>
	<div id="tools">
		<table>
			<tr>
				<td id="chemin"><a href="/fr/index.html">Accueil</a> > <a href="/fr/moncompte/">Mon compte</a> > Ma commande</td>
				<td id="search">
					<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/displaytoolbar.php'; ?>


				</td>
            </tr>
        </table>
    </div>
    <table id="body" class="widescreen">
		<tr class="top"><td colspan="2"></td></tr>
	    <tr class="middle"><td class="content">
			<?
			$query = "(SELECT cart.pro_id, pro_nom, pro_nom_cn, pro_quantity, pro_poids, pro_prix FROM cart, produit WHERE user_id = '".$_SESSION['user_id']."' AND produit.pro_id = cart.pro_id AND com_id = '".$_GET['cmd']."') UNION (SELECT cart.pro_id, rec_nom, '', pro_quantity, '', rec_prix FROM cart, recette WHERE user_id = '".$_SESSION['user_id']."' AND com_id = '".$_GET['cmd']."' AND recette.rec_id = cart.pro_id)";
			$q1 = mysql_query($query);
			$c = @mysql_num_rows($q1);
			if($c==0){
			?>
			<table>
				<tr>
					<td colspan="5"><h2>Erreur</h2></td>
				</tr>
				<tr class="ligne">
					<td><br />Veuillez réessayer ultérieurement.<br /><br /></td>
				</tr>
			</table>
			<? } else {
			$q2 = mysql_query("SELECT com_date FROM `command` WHERE user_id = '".$_SESSION['user_id']."' AND com_id = '".$_GET['cmd']."'");
			$r2 = mysql_fetch_array($q2);
			$date0 = split(" ", $r2['com_date']);
			$date1 = split("-", $date0[0]);
			$hour1 = split(":", $date0[1]);
			//$date = date("d/m/Y", mktime(0, 0, 0, $date1[1], $date1[2], $date1[0]));
			$date = $date1[2]."/".$date1[1]."/".$date1[0];
			//$hour = date("H:i", mktime($hour1[0], $hour1[1], $hour1[2], $date1[2], $date1[1], $date1[0]));
			$hour = $hour1[0].":".$hour1[1];
			?>
			<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/facture.php'; ?>
			<div id="options">
				<table class="clear">
					<tr><td colspan="2" class="bar"><img src="/img/common/lightgreybar.gif" alt="" /></td></tr>
				</table>
				<table>
					<tr>
						<td colspan="6"><a href="javascript:window.print()"><img src="/img/common/btn/print.gif" alt="Imprimer" /></a> <a href="/fr/moncompte/"><img src="/img/common/retour.gif" alt="Retour" /></a></td>
					</tr>
					<tr><td colspan="6">&nbsp;</td></tr>
				</table>
			</div>
			<? } ?>
		</td></tr>
		<tr class="bottom"><td colspan="2"></td></tr>
	</table>
	<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/footer.php'; ?>
</body>
</html>
